package myapps.ttclient.dialog;

import myapps.ttclient.R;
import myapps.ttclient.activity.ppt.PPTSlideShowScreenActivity;
import myapps.ttclient.app.TTClientApplication;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;

public class DSActionsPlusPlusDialog implements OnClickListener {
	
	private final static int ENABLE_DRAWING_SCSREEN = 0;
	private final static int DISABLE_DRAWING_SCSREEN = 1;
	private final static int CLEAR_CURRENT_SLIDE = 2;
	private final static int CLEAR_ALL_SLIDES = 3;
	private final static int SAVE = 4;
	private final static int LOAD = 5;

	private PPTSlideShowScreenActivity m_pptSlideShowScreenActivity;

	private TTClientApplication m_application;

	private String[] m_strings;

	private AlertDialog m_dialog;


	public DSActionsPlusPlusDialog(PPTSlideShowScreenActivity pptSlideShowScreenActivity, TTClientApplication application)
	{
		this.m_pptSlideShowScreenActivity = pptSlideShowScreenActivity;

		this.m_application = application;

		this.m_strings = 
			pptSlideShowScreenActivity.getResources().getStringArray(R.array.ds_action_names);

		this.init();
	}

	private void init()
	{
		AlertDialog.Builder builder = new AlertDialog.Builder(this.m_pptSlideShowScreenActivity);
		builder.setItems(m_strings, this);

		m_dialog = builder.create();
	}

	public void show()
	{
		m_dialog.show();
	}

	@Override
	public void onClick(DialogInterface dialog, int which) {
		if(m_dialog == dialog)
		{
			switch (which) {
			case DSActionsPlusPlusDialog.ENABLE_DRAWING_SCSREEN:
				m_pptSlideShowScreenActivity.on_Enable_Drawing_Screen();
				break;

			case DSActionsPlusPlusDialog.DISABLE_DRAWING_SCSREEN:
				m_pptSlideShowScreenActivity.on_Disable_Drawing_Screen();
				break;
				
			case DSActionsPlusPlusDialog.CLEAR_CURRENT_SLIDE:
				m_pptSlideShowScreenActivity.on_Clear_Current_Slide();
				break;
				
			case DSActionsPlusPlusDialog.CLEAR_ALL_SLIDES:
				m_pptSlideShowScreenActivity.on_Clear_All_Slides();
				break;
				
			case DSActionsPlusPlusDialog.SAVE:
				m_pptSlideShowScreenActivity.on_Save();
				break;
				
			case DSActionsPlusPlusDialog.LOAD:
				m_pptSlideShowScreenActivity.on_Load();
				break;

			default:
				break;
			}
		}
	}
}
